<!--  -->
<template>
  <!-- <cube-scroll
    ref="scroll"
    :data="list"
    :options="options"
    @pulling-down="onPullingDown"
    @pulling-up="onPullingUp"
  >-->
  <Pad>
    <van-skeleton title :row="3" :loading="loading"/>
    <van-skeleton title :row="3" :loading="loading"/>
    <van-skeleton title :row="3" :loading="loading"/>
    <div class="no-data" v-if="!loading && list.length == 0">暂无反馈</div>
    <feedback
      v-for="data in list"
      :key="data.vaccinationInformationId"
      :data="data"
      @submit="submit"
      :followInfo='followInfo'
    />
  </Pad>
  <!-- </cube-scroll> -->
</template>

<script>
import Pad from "@/components/pad";
import Feedback from "./feedback";
import { getInformatics } from "@/api/user";
import { follow, followInfo } from "@/api/user";
export default {
  components: { Pad, Feedback },
  data() {
    return {
      loading: true,
      list: [],
      queryParams: {
        current: 1,
        size: 10
      },
      options: {
        // pullDownRefresh: true,
        pullUpLoad: true
      },
      followInfo: {}
    };
  },
  created() {
    this.getList().then(res => {
      this.loading = false;
      this.list = res.data;
      this.options.pullUpLoad = true;
    });

    followInfo().then(res => {
      this.followInfo = res.data;
    });
  },
  //方法集合
  methods: {
    getList() {
      return getInformatics(this.queryParams);
    },
    onPullingDown() {
      console.log("下拉刷新");
      this.queryParams.current = 1;
      this.getList();
    },
    onPullingUp() {
      console.log("上拉加载");
      this.queryParams.current += 1;
      this.getList().then(({ data }) => {
        this.data = [...this.data, ...data];
        this.$refs.scroll.forceUpdate(false, true);
        // 已经没有更多页
        if (data.current >= data.pages) {
          this.options.pullUpLoad = false;
          this.$refs.scroll.refresh();
        }
      });
    },
    submit() {
      this.queryParams.current = 1;
      this.getList().then(res => {
        this.list = res.data;
        this.options.pullUpLoad = true;
      });
    }
  },
  //生命周期 - 挂载完成（可以访问DOM元素）
  mounted() {}
};
</script>
<style lang='scss' scoped>
</style>